/**
 * 
 */
package arisufascion.com.adapter;

import java.util.List;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import arisufascion.com.R;

/**
 * @author Kelvin
 *
 */
public class SpinnerAdapter extends ArrayAdapter<String> {
	 private Activity activity;
	 private List<String> arr;
	 
    public SpinnerAdapter(Activity ctx, int txtViewResourceId,List<String> arr) {
        super(ctx, txtViewResourceId, arr);
        this.activity=ctx;
        this.arr=arr;
    }

    @Override
    public View getDropDownView(int position, View cnvtView, ViewGroup prnt) {
        return getCustomView(position, cnvtView, prnt);
    }
    @Override
    public View getView(int pos, View cnvtView, ViewGroup prnt) {
        return getCustomView(pos, cnvtView, prnt);
    }
    public View getCustomView(int position, View convertView,
            ViewGroup parent) {
        LayoutInflater inflater =activity.getLayoutInflater();
        View mySpinner = inflater.inflate(R.layout.row_spinner, parent,
                false);
        TextView main_text = (TextView) mySpinner
                .findViewById(R.id.tv_spinner);
        
        main_text.setText(arr.get(position));


        return mySpinner;
    }
}


